/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pa165.languageschoolpersistence.entities;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

/**
 *
 * @author Elena Medvedeva LevelofLanguage is an entity in representing the
 * connection between language and level.
 * @attribute ID LevelofLanguages id, generated automatically, cannot be 0.
 * @attribute languageSpoken languageSpoken by lector.Can be only of type
 * LanguageSpoken
 * @attribute level languageLevel of the language of the lector. Can be only of
 * type LanguageLevel
 * @attribute lector lector who speaks the language with the level.
 */
@Entity
public class LevelofLanguage implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    LanguageSpoken languageSpoken;
    LanguageLevel level;
    @ManyToOne
    private Lector lector;

    public Lector getLector() {
        return lector;
    }

    public void setLector(Lector lector) {
        this.lector = lector;
    }

    public LanguageSpoken getLanguageSpoken() {
        return languageSpoken;
    }

    public void setLanguageSpoken(LanguageSpoken languageSpoken) {
        this.languageSpoken = languageSpoken;
    }

    public LanguageLevel getLevel() {
        return level;
    }

    public void setLevel(LanguageLevel level) {
        this.level = level;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {

        if (!(object instanceof LevelofLanguage)) {
            return false;
        }
        LevelofLanguage other = (LevelofLanguage) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "LavelofLanguage[ id=" + id + ", level=" + this.level + ", language=" + this.languageSpoken + " , lector= " + this.lector + " ]";
    }
}
